import request from '@/utils/request'

const wxUserApi = '/wxUser'

/**
 * 获取微信用户列表
 * @param params
 * @returns {AxiosPromise}
 */
export const listWxUser = (params) => {
  return request({
    url: `${wxUserApi}/list`,
    method: 'GET',
    params
  })
}

/**
 * 分页查询微信用户列表
 * @param params
 * @returns {AxiosPromise}
 */
export const pageWxUser = (params) => {
  return request({
    url: `${wxUserApi}`,
    method: 'GET',
    params
  })
}

/**
 * 新增微信用户
 * @param data 微信用户数据
 * @returns {AxiosPromise}
 */
export const addWxUser = (data) => {
  return request({
    url: `${wxUserApi}`,
    method: 'POST',
    data
  })
}


/**
 * 根据id查询微信用户信息
 * @param id 微信用户id
 * @returns {AxiosPromise}
 */
export const getWxUser = (id) => {
  return request({
    url: `${wxUserApi}/${id}`,
    method: 'GET'
  })
}


/**
 * 根据ID删除微信用户
 * @param id 微信用户id
 * @returns {AxiosPromise}
 */
export const delWxUser = (id) => {
  return request({
    url: `${wxUserApi}/${id}`,
    method: 'DELETE'
  })
}

/**
 * 同步微信用户
 * @returns {AxiosPromise}
 */
export const syncWxUser = () => {
  return request({
    url: `${wxUserApi}/sync`,
    method: 'POST',
  })
}

/**
 * 微信用户状态修改
 * @param id
 * @param wxUserGroup
 * @returns {AxiosPromise}
 */
export const changeWxUserStatus = (id, status) => {
  const data = {
    id,
    status
  }
  return request({
    url: `${wxUserApi}/changeStatus`,
    method: 'PUT',
    data
  })
}

/**
 * 修改微信备注
 * @param id
 * @param remark
 * @returns {AxiosPromise}
 */
export const updateWxUserRemark = (id, remark) => {
  const data = {
    id,
    remark
  }
  return request({
    url: `${wxUserApi}/updateRemark`,
    method: 'PUT',
    data
  })
}
